<template>
      <el-card shadow="hover" class="msg-cont">
        <div class="list">
          <ul class="head">
            <li style="width: 120px">留言用户</li>
            <li class="item-message">留言内容</li>
            <li style="width: 160px">留言时间</li>
            <li class="text-right" style="width: 140px">
              <span style="vertical-align: middle; margin-right: 4px"
                >得标</span
              >
              <el-tooltip placement="bottom">
                <template #content>
                  <div style="width: 200px">
                    如果用户没有命中竞标关键字，可以点击『得标』，确认该用户也是得标者。已得标的用户，也可以手动
                    『取消得标』。
                  </div>
                </template>
                <el-icon
                  :size="16"
                  color="#58919f"
                  style="vertical-align: middle"
                  ><InfoFilled
                /></el-icon>
              </el-tooltip>
            </li>
          </ul>
          <el-scrollbar ref="scrollbarRef" class="scroll">
            <ul class="content" v-for="(item, index) in tableData">
              <li style="width: 120px">
                <div class="cell">{{ item.fb_user_name }}</div>
              </li>
              <li class="item-message">
                <div class="cell">
                  {{ item.message }}
                  <el-button
                    link
                    :icon="ChatDotRound"
                    type="primary"
                  ></el-button>
                </div>
              </li>
              <li style="width: 160px">
                <div class="cell">{{ item.time }} 12:01:02</div>
              </li>
              <li style="width: 140px" class="text-right">
                <div class="cell">
                  <el-button
                    v-if="item.win_bid == 0"
                    link
                    size="small"
                    type="info"
                    >得标</el-button
                  >
                  <div v-else>
                    <span class="primaryColor font-sm mr">已得标</span>
                    <el-button
                      link
                      size="small"
                      type="danger"
                      @click="cancelWin(index, item)"
                      >取消得标</el-button
                    >
                  </div>
                </div>
              </li>
            </ul>
            <div class="more">
              <div>没有数据了</div>
              <el-button link :loading="moreLoading">点击加载更多</el-button>
            </div>
          </el-scrollbar>
        </div>
        <!-- <el-table
          :data="tableData"
          stripe
          style="width: 100%"
          class="scroll"
          :header-cell-style="{
            background: '#ECEFF5',
            paddingTop: '22px',
            paddingBottom: '20px',
          }"
        >
          <el-table-column label="留言用户" prop="fb_user_name" width="150" />
          <el-table-column label="留言内容" prop="message" />
          <el-table-column label="留言时间" prop="time" width="150" />
          <el-table-column align="right" width="150">
            <template #header>
              <span style="vertical-align: middle; margin-right: 4px"
                >得标</span
              >
              <el-tooltip placement="bottom">
                <template #content>
                  <div style="width: 200px">
                    如果用户没有命中竞标关键字，可以点击『得标』，确认该用户也是得标者。已得标的用户，也可以手动
                    『取消得标』。
                  </div>
                </template>
                <el-icon
                  :size="16"
                  color="#58919f"
                  style="vertical-align: middle"
                  ><InfoFilled
                /></el-icon>
              </el-tooltip>
            </template>
            <template #default="scope">
              <el-button
                v-if="scope.row.win_bid == 0"
                link
                size="small"
                type="info"
                >得标</el-button
              >
              <div v-else>
                <span class="primaryColor font-sm mr">已得标</span>
                <el-button
                  link
                  size="small"
                  type="danger"
                  @click="cancelWin(scope.$index, scope.row)"
                  >取消得标</el-button
                >
              </div>
            </template>
          </el-table-column>
        </el-table> -->

        <template #footer>
          <div class="operate">
            <div class="head flex justify-between align-center">
              <div>
                @
                <el-tag
                  type="primary"
                  size="large"
                  effect="plain"
                  round
                  closable
                >
                  小百合
                </el-tag>
              </div>
              <div>
                <el-button :icon="Search" type="warning" plain circle />
                <el-button :icon="Download" type="info" plain circle />
                <el-button :icon="Refresh" type="primary" plain circle />
              </div>
            </div>
            <div class="mt-2">
              <el-input
                v-model="msg"
                style="width: 100%"
                :rows="3"
                type="textarea"
                autofocus
              />
              <div class="flex justify-end mt-15">
                <el-button type="primary" :icon="Promotion">发送</el-button>
              </div>
            </div>
          </div>
        </template>
      </el-card>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted, nextTick } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useLocaleStore } from "@/store/locales";
import {
  InfoFilled,
  Edit,
  Search,
  Download,
  Refresh,
  ChatDotRound,
  ArrowDown,
  Promotion
} from "@element-plus/icons-vue";
import { $getVideo, $getMsg, $sendMsg,$getSales } from "@api/live";
const useLocale = useLocaleStore();
document.getElementsByTagName("body")[0].className = useLocale.theme;
const props = defineProps({
  id: {
    type: String,
    default: "",
  },
});
const msg=ref('');//留言
const moreLoading=ref(false);
console.log(222);
console.log(props.id);
const tableData = ref([]);
let params = ref({
  fb_user_name: "",
  message: "",
  live_id: props.id,
  page_size:10,
  current_page:10,
});

onMounted(() => {
  getData();
});
const getData = async () => {
  let res = await $getMsg(params.value);
  if (res.code == 0) {
    tableData.value = res.data.table;
  }
};


const cancelWin = async (index,row) => {
  console.log(row);
};

</script>
<style>
.msg-cont {
  .el-card__body {
    padding: 0;
  }
}
.ec2-btncon {
  .el-button {
    margin-bottom: 2px;
    justify-content: flex-start;
  }
  .el-button + .el-button {
    margin-left: 0;
  }
}
</style>
<style scoped lang="scss">
.list {
  .item-message {
  }
  color: var(--el-text-color-regular);
  .head {
    display: table;
    background: rgb(236, 239, 245);
    padding-top: 18px;
    padding-bottom: 12px;
    width: 100%;
    font-size: 14px;
    li {
      display: table-cell;
      box-sizing: border-box;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: normal;
      word-break: break-all;
      line-height: 23px;
      padding: 0 12px;
      font-weight: 600;
    }
  }
  .content {
    display: table-row;
    width: 100%;
    font-size: 13px;
    &:nth-child(even) {
      background-color: var(--el-fill-color-lighter); /* 双行交替色 */
    }
    &:hover {
      background-color: #f5f7fa;
    }
    li {
      display: table-cell;
      padding: 8px 0;
      min-width: 0;
      box-sizing: border-box;
      text-overflow: ellipsis;
      vertical-align: middle;
      position: relative;
      z-index: var(--el-table-index);
      border-bottom: 1px solid #ebeef5;
      .cell {
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-all;
        line-height: 23px;
        padding: 0 12px;
      }
    }
  }
  .more {
    text-align: center;
    font-size: 13px;
    padding: 10px;
    color: #606366;
  }
}
.operate{
  height:215px;
}
.scroll {
  height: calc(100vh - 350px);
}
.ec2-btncon {
  display: flex;
  flex-direction: column;
}
.primaryColor {
  color: var(--el-color-primary);
}
</style>
